handleDragOver(source, _actor, _x, _y, _time) {
if (source.realWindow && !this._isMyWindow(source.realWindow))
return DND.DragMotionResult.MOVE_DROP;
- if (source.shellWorkspaceLaunch)
+ if (source.app)
+ return DND.DragMotionResult.COPY_DROP;
+ if (!source.app && source.shellWorkspaceLaunch)
return DND.DragMotionResult.COPY_DROP;
return DND.DragMotionResult.CONTINUE;
}
acceptDrop(source, actor, x, y, time) {
+ let workspaceManager = global.workspace_manager;
+ let workspaceIndex = this.metaWorkspace
+ ? this.metaWorkspace.index()
+ : workspaceManager.get_active_workspace_index();
+
if (source.realWindow) {
let win = source.realWindow;
if (this._isMyWindow(win))
if (metaWindow.get_monitor() != this.monitorIndex)
metaWindow.move_to_monitor(this.monitorIndex);
- let workspaceManager = global.workspace_manager;
- let index = this.metaWorkspace ? this.metaWorkspace.index() : workspaceManager.get_active_workspace_index();
- metaWindow.change_workspace_by_index(index, false);
+ metaWindow.change_workspace_by_index(workspaceIndex, false);
+ return true;
+ } else if (source.app) {
+ source.app.open_new_window(workspaceIndex);
return true;
- } else if (source.shellWorkspaceLaunch) {
- source.shellWorkspaceLaunch({ workspace: this.metaWorkspace ? this.metaWorkspace.index() : -1,
+ } else if (!source.app && source.shellWorkspaceLaunch) {
+ // While unused in our own drag sources, shellWorkspaceLaunch allows
+ // extensions to define custom actions for their drag sources.
+ source.shellWorkspaceLaunch({ workspace: workspaceIndex,
timestamp: time });
return true;
}
if (source.realWindow && !this._isMyWindow(source.realWindow))
return DND.DragMotionResult.MOVE_DROP;
- if (source.shellWorkspaceLaunch)
+ if (source.app)
+ return DND.DragMotionResult.COPY_DROP;
+ if (!source.app && source.shellWorkspaceLaunch)
return DND.DragMotionResult.COPY_DROP;
return DND.DragMotionResult.CONTINUE;
metaWindow.change_workspace_by_index(this.metaWorkspace.index(), false);
return true;
- } else if (source.shellWorkspaceLaunch) {
- source.shellWorkspaceLaunch({ workspace: this.metaWorkspace ? this.metaWorkspace.index() : -1,
+ } else if (source.app) {
+ source.app.open_new_window(this.metaWorkspace.index());
+ return true;
+ } else if (!source.app && source.shellWorkspaceLaunch) {
+ // While unused in our own drag sources, shellWorkspaceLaunch allows
+ // extensions to define custom actions for their drag sources.
+ source.shellWorkspaceLaunch({ workspace: this.metaWorkspace.index(),
timestamp: time });
return true;
}
// Draggable target interface
handleDragOver(source, actor, x, y, time) {
- if (!source.realWindow && !source.shellWorkspaceLaunch && source != Main.xdndHandler)
+ if (!source.realWindow &&
+ !source.app &&
+ (source.app || !source.shellWorkspaceLaunch) &&
+ source != Main.xdndHandler)
return DND.DragMotionResult.CONTINUE;
let canCreateWorkspaces = Meta.prefs_get_dynamic_workspaces();
if (this._dropWorkspace != -1) {
return this._thumbnails[this._dropWorkspace].acceptDropInternal(source, time);
} else if (this._dropPlaceholderPos != -1) {
- if (!source.realWindow && !source.shellWorkspaceLaunch)
+ if (!source.realWindow &&
+ !source.app &&
+ (source.app || !source.shellWorkspaceLaunch))
return false;
let isWindow = !!source.realWindow;
if (source.metaWindow.get_monitor() != thumbMonitor)
source.metaWindow.move_to_monitor(thumbMonitor);
source.metaWindow.change_workspace_by_index(newWorkspaceIndex, true);
- } else if (source.shellWorkspaceLaunch) {
+ } else if (source.app) {
+ source.app.open_new_window(newWorkspaceIndex);
+ } else if (!source.app && source.shellWorkspaceLaunch) {
+ // While unused in our own drag sources, shellWorkspaceLaunch allows
+ // extensions to define custom actions for their drag sources.
source.shellWorkspaceLaunch({ workspace: newWorkspaceIndex,
timestamp: time });
+ }
+
+ if (source.app || (!source.app && source.shellWorkspaceLaunch)) {
// This new workspace will be automatically removed if the application fails
// to open its first window within some time, as tracked by Shell.WindowTracker.
// Here, we only add a very brief timeout to avoid the _immediate_ removal of the